define(['angular', 'app', 'ngUiRouter', 'app.services','services/common/base'], function (angular, app,service) {

    'use strict';

    app.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {

        app.loadJs = function(js){
            return function($rootScope, $q){
                var def = $q.defer(), deps=[];
                angular.isArray(js) ? (deps = js) : deps.push(js);
                require(deps,function(){
                    $rootScope.$apply(function(){
                        def.resolve();
                    });
                });
                return def.promise;
            };
        }

        $urlRouterProvider.otherwise(function(){
            return "/PageTab1"
        });
        /**
         * 基础路由
         */
        $stateProvider.state("PageTab1", {
                url: "/PageTab1",
                templateUrl: "/app/partial/partone/pageone_1.html"
            });
        $stateProvider.state("PageTab1.next", {
                url: "/next",
                resolve: {
                    deps:app.loadJs(['directives/partone/directiveone'])
                },
                template: "<get-name></get-name>"
        })

    }]);
});